package com.group02.community.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.group02.community.entity.owner.ZyOwnerRoom;
import com.group02.community.entity.vo.OwnerVO;
import com.group02.community.service.OwnerRoomService;
import com.group02.community.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin
@RestController
public class OwnerRoomController {

    @Autowired
    private OwnerRoomService ownerRoomService;

    /**
     *获取未被解绑的房屋的全部信息（0审核，1绑定，2审核失败）
     * @return
     */
    @GetMapping("/ownerRoom")
    public ResponseResult<List<ZyOwnerRoom>> getBindOwnerRoom(){
        return ResponseResult.ok(ownerRoomService.list());
    }

    /**
     * 获取所有的ownerRoom（包括roomStatus的信息）
     * @return
     */
    @GetMapping("/ownerRooms")
    public ResponseResult<IPage<OwnerVO>> getAllOwnerRoom(Long current, Long size, String status){
        return ResponseResult.ok(ownerRoomService.getAllOwnerRoom(current,size,status));
    }
}
